package com.abe.libcore.core.http;

import android.text.TextUtils;

import com.google.gson.Gson;

import okhttp3.RequestBody;

public class HttpLocalLog {
    private String startMessage;
    private RequestBody body;
    private Exception exception;
    private String response;

    public String getStartMessage() {
        return startMessage;
    }

    public void setStartMessage(String startMessage) {
        this.startMessage = startMessage;
    }


    public RequestBody getBody() {
        return body;
    }

    public void setBody(RequestBody body) {
        this.body = body;
    }

    public Exception getException() {
        return exception;
    }

    public void setException(Exception exception) {
        this.exception = exception;
    }

    public String getResponse() {
        return response;
    }

    public void setResponse(String response) {
        this.response = response;
    }

    @Override
    public String toString() {
        StringBuilder builder = new StringBuilder();
        String newLine = "\r\n";
        builder.append("================================================================================================").append(newLine);
        builder.append("Http:url**********").append(startMessage).append(newLine);
        if (body != null)
            builder.append("Http:params*******").append(new Gson().toJson(body)).append(newLine);
        builder.append("Http:response*****").append(response).append(newLine);
        if (exception != null)
            builder.append("Http:exception****").append(exception.getMessage()).append(newLine);
        return builder.toString();
    }
}
